#ifndef CHAT_MANAGER_H
#define CHAT_MANAGER_H

#include"campus_chat_server.h"

#define CHAT_SERVER_PORT 9003

class CampusChatManager : public ChatServerObserver
{

struct ChatClient {
    std::string uid;
    int roomId;
    websocketpp::connection_hdl hdl;
};
public:
    CampusChatManager(int port_ = CHAT_SERVER_PORT);
    ~CampusChatManager();
    
    void start();
    void wait();

private:
    virtual void handleChatMsg(websocketpp::connection_hdl hdl, json JMsg) override;
    virtual void handleChatJoin(websocketpp::connection_hdl hdl, json JMsg) override;

private:
    std::map<int, std::vector<ChatClient>> room_map;
    std::shared_ptr<CampusChatServer> chat_server_;
};

#endif